﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using RuanGong.background.A.Classes;
using RuanGong.background.A;

namespace RuanGong.foreground.A
{
    public partial class CodeForm : Form
    {
        health_information currentHealthInfo;

        public CodeForm(health_information health)
        {
            InitializeComponent();
            currentHealthInfo = health;
            NameLabel2.Text = health.name;
            IDlabel.Text = health.Id.ToString();
            ShowHealthLevel(health.health_level);
        }

        private void ShowHealthLevel(int healthLevel)   //赋码
        {
            ComponentResourceManager resourceManager = new ComponentResourceManager(typeof(CodeForm));

            switch (healthLevel)
            {
                case 1:
                    CodePictureBox.Image = Properties.Resources.green;
                    break;
                case 2:
                    CodePictureBox.Image = Properties.Resources.yellow;
                    break;
                case 3:
                    CodePictureBox.Image = Properties.Resources.red;
                    break;
            }
        }

        private void SuggestButton_Click(object sender, EventArgs e)   //打开医嘱界面
        {
            Suggest suggest = new Suggest(currentHealthInfo);
            suggest.ShowDialog();
        }

        private void BackButton_Click(object sender, EventArgs e)   //返回到主界面
        {
            this.Close();
        }
    }
}
